Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of CSI: don't overwrite context with empty value from request into release/1.9.x #24928

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #24922 to be assessed for backporting due to the inclusion of the label backport/1.9.x.

The below text is copied from the body of the original PR.


When a volume is updated, we merge the new definition to the old. But the volume's context comes from the plugin and is likely not present in the user's volume specification. Which means that if the user re-submits the volume specification to make an adjustment to the volume, we wipe out the context field which might be required for subsequent operations by the CSI plugin. This was discovered to be a problem with the Terraform provider and fixed there, but it's also a problem for users of the volume create and volume register commands.

Update the merge so that we only overwrite the value of the context if it's been explictly set by the user. We still need to support user-driven updates to context for the volume register workflow.

Ref: hashicorp/terraform-provider-nomad#503
Fixes: democratic-csi/democratic-csi#438

Testing & Reproduction steps

Using the Democratic CSI plugin.

Before

$ nomad volume create ./volume.hcl
Created external volume csi-volume-nfs with ID csi-volume-nfs

$ nomad operator api "/v1/volume/csi/csi-volume-nfs?namespace=prod" | jq .Context
{
  "provisioner_driver": "nfs-client",
  "node_attach_driver": "nfs",
  "server": "192.168.1.170",
  "share": "/srv/nfs_data/v/csi-volume-nfs"
}

$ nomad volume create ./volume.hcl
Created external volume csi-volume-nfs with ID csi-volume-nfs

$ nomad operator api "/v1/volume/csi/csi-volume-nfs?namespace=prod" | jq .Context
{}

After

$ nomad volume create ./volume.hcl
Created external volume csi-volume-nfs with ID csi-volume-nfs

$ nomad operator api "/v1/volume/csi/csi-volume-nfs?namespace=prod" | jq .Context
{
  "server": "192.168.1.170",
  "share": "/srv/nfs_data/v/csi-volume-nfs",
  "provisioner_driver": "nfs-client",
  "node_attach_driver": "nfs"
}

$ nomad volume create ./volume.hcl
Created external volume csi-volume-nfs with ID csi-volume-nfs

$ nomad operator api "/v1/volume/csi/csi-volume-nfs?namespace=prod" | jq .Context
{
  "provisioner_driver": "nfs-client",
  "node_attach_driver": "nfs",
  "server": "192.168.1.170",
  "share": "/srv/nfs_data/v/csi-volume-nfs"
}

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad website documentation to reflect this. Refer to
    the website README for docs guidelines. Please also consider whether the
    change requires notes within the upgrade guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.

Overview of commits

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/b-csi-context-overwrite/vigorously-excited-pangolin branch from 1560a5e to 2a7120f Compare January 23, 2025 19:06
@tgross tgross merged commit bb4cf43 into release/1.9.x Jan 23, 2025
24 checks passed
@tgross tgross deleted the backport/b-csi-context-overwrite/vigorously-excited-pangolin branch January 23, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants